package com.ruoyi.web.controller;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.domain.JsonResponse;
import com.ruoyi.system.domain.dto.QuaStatisticsDto;
import com.ruoyi.system.domain.vo.LargeScreenVo;
import com.ruoyi.system.service.LargeScreenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/largeScreen")
@Api(tags = "大屏统计")
public class LargeScreenController {

    @Resource
    private LargeScreenService largeSereenService;
    @Anonymous
    @ApiOperation("平台管理人数")
    @PostMapping("/ptglrs")
    public JsonResponse<Integer> ptglrs() {
        return JsonResponse.ok(largeSereenService.queryNum());
    }

    @Anonymous
    @ApiOperation("太原市高危人数统计")
    @PostMapping("/tysscrstj")
    public JsonResponse<LargeScreenVo.Tysscrstj> tysscrstj(@RequestBody @Validated QuaStatisticsDto.QueryPatient dto) throws ParseException {
        return JsonResponse.ok(largeSereenService.tysscrstj());
    }

    @Anonymous
    @ApiOperation("二级医疗机构高危人群年龄段人数分布统计")
    @PostMapping("/tysscnldrstj")
    public JsonResponse<LargeScreenVo.Tysscnldrstj> tysscnldrstj(@RequestBody @Validated QuaStatisticsDto.QueryPatient dto) throws ParseException {
        return JsonResponse.ok(largeSereenService.tysscnldrstj());
    }
//
//    @Anonymous
//    @ApiOperation("二级医疗机构高危人群病种分布统计")
//    @PostMapping("/eryybzfb")
//    public JsonResponse<LargeScreenVo.Eryybzfb> eryybzfb(@RequestBody @Validated QuaStatisticsDto.QueryPatient dto) throws ParseException {
//        return JsonResponse.ok(largeSereenService.eryybzfb());
//    }

    @Anonymous
    @ApiOperation("社区医疗机构人群分布")
    @PostMapping("/tysczgltj")
    public JsonResponse<LargeScreenVo.Tysczgltj> tysczgltj(@RequestBody @Validated QuaStatisticsDto.QueryPatient dto) throws ParseException {
        return JsonResponse.ok(largeSereenService.tysczgltj());
    }

    @Anonymous
    @ApiOperation("本院卒中分类占比")
    @PostMapping("/tysczflzb")
    public JsonResponse<LargeScreenVo.Tysczflzb> tysczflzb(@RequestBody @Validated QuaStatisticsDto.QueryPatient dto) throws ParseException {
        return JsonResponse.ok(largeSereenService.tysczflzb());
    }

    @Anonymous
    @ApiOperation("二级医疗机构高危人群病种分布统计")
    @PostMapping("/byzyrqfb")
    public JsonResponse<LargeScreenVo.Byzyrqfb> byzyrqfb(@RequestBody @Validated QuaStatisticsDto.QueryPatient dto) throws ParseException {
        LargeScreenVo.Byzyrqfb byzyrqfb = largeSereenService.byzyrqfb();
        return JsonResponse.ok(byzyrqfb);
    }

    @Anonymous
    @ApiOperation("神经血管疾病住院人群统计")
    @PostMapping("/bysjnwkzyrstj")
    public JsonResponse<LargeScreenVo.Bysjnwkzyrstj> bysjnwkzyrstj(@RequestBody @Validated QuaStatisticsDto.QueryPatient dto) throws ParseException {
        LargeScreenVo.Bysjnwkzyrstj tysczgltj = largeSereenService.bysjnwkzyrstj();
        return JsonResponse.ok(tysczgltj);
    }

    @Anonymous
    @ApiOperation("神经血管疾病年龄段分布")
    @PostMapping("/bysjnwknldrstj")
    public JsonResponse<LargeScreenVo.Bysjnwknldrstj> bysjnwknldrstj(@RequestBody @Validated QuaStatisticsDto.QueryPatient dto) throws ParseException {
        LargeScreenVo.Bysjnwknldrstj tysscnldrstj = largeSereenService.tysscnldrstjBy();
        return JsonResponse.ok(tysscnldrstj);
    }

    @Anonymous
    @ApiOperation("国家质控网卒中治疗分布")
    @PostMapping("/gjzkwczzlfb")
    public JsonResponse<LargeScreenVo.Gjzkwczzlfb> gjzkwczzlfb(@RequestBody @Validated QuaStatisticsDto.QueryPatient dto) throws ParseException {
        return JsonResponse.ok(largeSereenService.gjzkwczzlfb());
    }

    @Anonymous
    @ApiOperation("国家DNT质控")
    @PostMapping("/bsdntzk")
    public JsonResponse<LargeScreenVo.Bsdntzk> bsdntzk(@RequestBody @Validated QuaStatisticsDto.QueryPatient dto) throws ParseException {
        LargeScreenVo.Bsdntzk bsdntzk = new LargeScreenVo.Bsdntzk();
        bsdntzk.setNum1(2);
        bsdntzk.setNum2(21);
        bsdntzk.setNum3(37);
        bsdntzk.setNum4(195);
        return JsonResponse.ok(bsdntzk);
    }

    @Anonymous
    @ApiOperation("本院DNT质控")
    @PostMapping("/zydntzk")
    public JsonResponse<LargeScreenVo.Zydntzk> zydntzk(@RequestBody @Validated QuaStatisticsDto.QueryPatient dto) throws ParseException {
        LargeScreenVo.Zydntzk zydntzk = new LargeScreenVo.Zydntzk();
        zydntzk.setNum1(2);
        zydntzk.setNum2(21);
        zydntzk.setNum3(37);
        zydntzk.setNum4(195);
        return JsonResponse.ok(zydntzk);
    }

    @Anonymous
    @ApiOperation("住院DPT质控")
    @PostMapping("/zydptzk")
    public JsonResponse<LargeScreenVo.Zydptzk> zydptzk(@RequestBody @Validated QuaStatisticsDto.QueryPatient dto) throws ParseException {
        LargeScreenVo.Zydptzk zydptzk = new LargeScreenVo.Zydptzk();
        zydptzk.setNum1(12);
        zydptzk.setNum2(17);
        zydptzk.setNum3(24);
        zydptzk.setNum4(202);
        return JsonResponse.ok(zydptzk);
    }



    @Anonymous
    @ApiOperation("本市卒中中心质控")
    @PostMapping("/bsczzxzk")
    public JsonResponse<LargeScreenVo.Bsczzxzk> bsczzxzk(@RequestBody @Validated QuaStatisticsDto.QueryPatient dto) throws ParseException {
        LargeScreenVo.Bsczzxzk bsczzxzk = new LargeScreenVo.Bsczzxzk();
        bsczzxzk.setDit(23);
        bsczzxzk.setDpt(106);
        bsczzxzk.setOdt(21);
        bsczzxzk.setPrt(24);
        bsczzxzk.setDnt(45);
        bsczzxzk.setDrt(151);

        return JsonResponse.ok(bsczzxzk);
    }

    @Anonymous
    @ApiOperation("本院卒中中心疾病种类分布")
    @PostMapping("/byczzxjbzlfb")
    public JsonResponse<LargeScreenVo.Byczzxjbzlfb> byczzxjbzlfb(@RequestBody @Validated QuaStatisticsDto.QueryPatient dto) throws ParseException {
//        LargeScreenVo.Byczzxjbzlfb byczzxjbzlfb = new LargeScreenVo.Byczzxjbzlfb();
//        byczzxjbzlfb.setQt(246);
//        byczzxjbzlfb.setCzhsmza(61);
//        byczzxjbzlfb.setDmdx(96);
//        byczzxjbzlfb.setNgs(1888);
//        byczzxjbzlfb.setNcx(94);
//        byczzxjbzlfb.setTia(44);
//        byczzxjbzlfb.setLnjmxsxc(69);
//        byczzxjbzlfb.setXgxcd(70);
//        byczzxjbzlfb.setZwmxqcx(49);
//        byczzxjbzlfb.setXgxpjs(48);


        LargeScreenVo.Byczzxjbzlfb byczzxjbzlfb = largeSereenService.byczzxjbzlfb(dto);
        return JsonResponse.ok(byczzxjbzlfb);
    }

    @Anonymous
    @ApiOperation("本院卒中中心质控")
    @PostMapping("/byczzxzk")
    public JsonResponse<LargeScreenVo.Bsczzxzk> byczzxzk(@RequestBody @Validated QuaStatisticsDto.QueryPatient dto) throws ParseException {
        LargeScreenVo.Bsczzxzk bsczzxzk = new LargeScreenVo.Bsczzxzk();
        bsczzxzk.setDit(18);
        bsczzxzk.setDpt(95);
        bsczzxzk.setOdt(20);
        bsczzxzk.setPrt(15);
        bsczzxzk.setDnt(38);
        bsczzxzk.setDrt(133);
        return JsonResponse.ok(bsczzxzk);
    }

    @Anonymous
    @ApiOperation("根据地区code查找医院及医院的数据")
    @PostMapping("/getHospitalAndNum")
    public JsonResponse<List<LargeScreenVo.getHospitalAndNum>> getHospitalAndNum(@RequestBody @Validated QuaStatisticsDto.getHospitalAndNumByCityCode dto) throws ParseException {
        List<LargeScreenVo.getHospitalAndNum> bsczzxzk = largeSereenService.getHospitalAndNum(dto);
        return JsonResponse.ok(bsczzxzk);
    }

}
